<template>
	<view class="container bg-w">
		<view class="header uni-flex uni-row flex-between">
			<uni-nav-bar title="资料列表">
				<template slot='left'>
					<view class="flex width-100">
						<i class='iconfont iconfanhui' @click='goBack()'></i>
					</view>
				</template>
			</uni-nav-bar>
		</view>
		<view class="position-r-top">
			<uni-search-bar :radius="100" @confirm="searchName" @cancel='cancelName' placeholder='请输入项目名称'></uni-search-bar>
			<uni-list>
			    <uni-list-item v-for="(item,index) in InformationList" :title="item.dataName" link showArrow :to="'/pages/supervise/InformationDocument/InformationList/Details/Details?dataId='+item.dataId"></uni-list-item>
			</uni-list>
		</view>
		
	</view>
</template>

<script>
	import { 
		getFileList
	} from '@/common/api/api.js'
	export default {
		data() {
			return {
				page:{
					pageNo:1,
					pageSize:20,
					type:null,
					dataName:null
				},
				totalPage:null,
				InformationList:[],
			}
		},
		onLoad(option) {
			this.page.type = option.type
			this.page.projectId = option.projectId
			this.getFileListMethod();
		},
		methods: {
			getFileListMethod(){
				getFileList(this.page).then(res => {
					this.InformationList = this.InformationList.concat(res.data.records)
				})
			},
			searchName(e){
				this.InformationList =[]
				this.page.dataName = e.value
				this.page.pageNo = 1
				this.getFileListMethod()
			},
			cancelName(){
				this.page.pageNo = 1
				this.page.dataName = null
				this.getFileListMethod()
			},
			onReachBottom() { //上拉加载更多
				this.page.pageNo++
				if (this.page.pageNo <= this.totalPage) {
					this.getFileListMethod();
				}
			},
		}
	}
</script>

<style lang="less">
	.uni-searchbar{background-color: #F2F2F2;}
	.buildList{
		.buildList-body{
			width: 90%;
			>view:first-child{
				margin-bottom: 20rpx;
			}
			>view{
				> view{
					width: 200rpx;
					text-align-last: justify;
				}
			}
		}
	}
</style>
